{% extends "admin/base_site.html" %}
{% load i18n %}

{% block extrahead %}
<style type="text/css">
.student {
    border: 1px solid black;
    margin-left: 1em;
    margin-top: 0.5em;
    padding: 0.5em;
    page-break-after: always; /* requested, but not ideal */
}
.student table td {
    padding-top: 0.25em;
    padding-bottom: 0.25em;
    padding-left: 0.5em;
    padding-right: 0.5em;
}
.markDescription {
    font-style: italic;
}
.maximumPoints {
    color: grey;
}
.categoryAverage {
    font-weight: bold;
}
.indent {
    padding-left: 1em;
}
.paddedRuler {
    background-color: black; /* super ornery */
    margin-top: 10px;
    margin-bottom: 10px;
}
@media print {
    .noPrint {
        display: none;
     }
}
</style>
{% endblock %}

{% block content %}
    <h1>{{ course }}</h2>
    <div class="noPrint">
    <h2>Upload grades</h2>
    <div class="indent">
    <form action="" method="post" enctype="multipart/form-data">
        {{ import_form }} 
        <input type="submit" value="Upload Grades" name="upload"/>
    </form>
    <p>{{ message }}</p>
    </div>
    <hr class="paddedRuler" />
    <h2>Display and verify grades</h2>
    <div class="indent">
    <form action="" method="post">
        {{ verify_form }}
        <input type="submit" value="Display Grades" name="verify" />
    </form>
    </div>
    <hr />
    </div>
    {% spaceless %}
    {% for mp in mps %}
	<h2>{{ mp.name }}</h2>
	{% for student in mp.students %}
	    <div class="student">
		<h3>{{ student }}</h3>
		<table>
		    <tr>
			{% for category in student.categories %}
			{% if category.marks %}
			    <td>
				<h4>{{ category.name }}</h4>
				<table>
				{% for mark in category.marks %}
				    <tr>
					<td>
					    {% if mark.item.name != 'None' %}
						{{ mark.item.name }}
					    {% endif %}
					    {% if mark.description and show_descriptions %}
						<br /><span class="markDescription">{{ mark.description }}</span>
					    {% endif %}
					</td>
					<td>{{ mark.mark }} <span class="maximumPoints">(of {{ mark.item.scale.maximum }})</span></td>
				    </tr>
				{% endfor %}
				</table>
			    </td>
			{% endif %}
			{% endfor %}
		    </tr>
		    <tr>
			{% for category in student.categories %}
			{% if category.marks %}
			    <td class="categoryAverage">
				Average: {{ category.average }}
			    </td>
			{% endif %}
			{% endfor %}
		    </tr>
		</table>
	    </div>
	{% endfor %}
    {% endfor %}
    {% endspaceless %}
{% endblock %}
